package com.wing.bill.controller.admin;

import com.wing.bill.service.SpecReportService;
import com.wing.common.utils.JsonResult;
import com.wing.web.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Validated
@Api(value = "Admin-刀具柜料号品名报表", tags = "#/bill/specReport")
@RestController("specReportController")
@RequestMapping("bill/admin/specReport")
@RequiredArgsConstructor
public class SpecReportController {
    private final SpecReportService specReportService;
    @ApiOperation(value = "顶部折线图", notes = "搜索")
    @GetMapping("/list")
    public JsonResult list(
            @RequestParam("param")String param  //qua 数量 money金额

    ){
        return specReportService.list(param,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "顶部格子", notes = "搜索")
    @GetMapping("/topCell")
    public JsonResult topCell(
            @RequestParam("click")String click,
            @RequestParam("startTime")String start,
            @RequestParam("endTime")String end,
            @RequestParam("mainCabCode")String mainCabCode
    ){
        return specReportService.topCell(start,end,Integer.valueOf(click),mainCabCode,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "第一个图领新", notes = "搜索")
    @GetMapping("/firstChart")
    public JsonResult firstChart(
            @RequestParam("param")String param,  //qua 数量 money金额
            @RequestParam("startTime")String start,
            @RequestParam("endTime")String end,
            @RequestParam("mainCabCode")String mainCabCode
    ){
        return specReportService.firstChart(start,end,param,mainCabCode,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "第二三四五个图", notes = "搜索")
    @GetMapping("/secondChart")
    public JsonResult secondChart(
            @RequestParam("param")String param,  //qua 数量 money金额
            @RequestParam("startTime")String start,
            @RequestParam("endTime")String end,
            @RequestParam("mainCabCode")String mainCabCode,
            @RequestParam("other")String other//temp 暂存 rep  报修 rec 报废 loss 报失
    ){
        return specReportService.secondChart(start,end,param,mainCabCode,JwtUtils.getEnterpriseCode(),other);
    }

    @ApiOperation(value = "第六个图", notes = "搜索")
    @GetMapping("/thirdChart")
    public JsonResult thirdChart(
            @RequestParam("param")String param,  //qua 数量 money金额
            @RequestParam("mainCabCode")String mainCabCode
    ){
        return specReportService.thirdChart(param,mainCabCode,JwtUtils.getEnterpriseCode());
    }
}
